<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="description" content="Moment.js 是一个 JavaScript 日期处理类库，用于解析、检验、操作、以及显示日期">
		<link rel="stylesheet" href="static/css/style.css">
		<link rel="shortcut icon" href="http://momentjs.cn/static/img/moment-favicon.png">
		<link rel="stylesheet" href="static/css/atom-one-light.min.css">

		<title>Moment.js 中文网</title>
	</head>

	<body class="is-moment">
		<nav class="nav">
			<div class="centered">
				<div class="nav-projects">
					<a class="nav-project nav-project-moment active" href="">
						<svg width="40px" height="40px" viewbox="0 0 40 40">
							<ellipse stroke-width="3" cx="20" cy="20" rx="18.5" ry="18.5" fill="0" stroke="#000"></ellipse>
							<path fill-rule="evenodd" d="M20,36 C28.836556,36 36,28.836556 36,20 C36,11.163444 28.836556,4 20,4 C11.163444,4 4,11.163444 4,20 C4,28.836556 11.163444,36 20,36 Z M20,5 C19.4477153,5 19,5.44994876 19,6.00684547 L19,19 L11.9970301,19 C11.4463856,19 11,19.4438648 11,20 C11,20.5522847 11.4556644,21 11.9953976,21 L21,21 L21,6.00087166 C21,5.4481055 20.5561352,5 20,5 Z"></path>
						</svg>
						Moment
					</a>
					<a class="nav-project nav-project-moment-timezone " href="index2.html">
						<svg width="40px" height="40px" viewbox="0 0 40 40">
							<ellipse stroke-width="3" cx="20" cy="20" rx="18.5" ry="18.5" fill="0" stroke="#000"></ellipse>
							<path fill-rule="evenodd" d="M4.98917024,14.4489557 C4.34944108,16.1782522 4,18.0483179 4,20 C4,28.836556 11.163444,36 20,36 C25.3372103,36 30.0640585,33.3867291 32.9708034,29.3699284 L32.9708034,29.3699284 C32.7542032,29.1158875 32.5851628,28.8136799 32.5213775,28.5419031 L31.2169086,22.9838131 C31.1059526,22.5110509 30.6116318,22.1192596 30.1152853,22.1192596 L28.4921437,22.1192596 C27.9858118,22.1192596 27.3609962,21.7891428 27.0742761,21.3819231 L26.5647528,20.6582629 C25.7154881,19.4520786 25.8505167,17.5995152 26.8651421,16.5187344 L26.9854581,16.3905737 C27.318883,16.0354089 27.9695174,15.6094255 28.4334461,15.4446996 L29.3188401,15.1303252 C29.7803195,14.966469 30.5349459,14.9655993 30.9988746,15.1303252 L31.8842686,15.4446996 C32.3457481,15.6085558 33.1107334,15.8458733 33.5874405,15.9728206 L35.6191135,16.513856 C35.4978108,15.9679684 35.3486212,15.4325805 35.1731165,14.9092644 C34.3263749,14.7238868 33.4055455,14.2746017 32.8663979,13.7497894 L32.3015162,13.1999272 L30.4205895,13.1999271 C29.9369463,13.1999271 29.3014167,13.5302589 29.0223398,13.9377438 L28.6896027,14.4235789 C28.1260613,15.2464153 27.4185905,15.1412987 27.0980851,14.2053481 L27.0412779,14.0394576 C26.882355,13.5753657 27.1532065,13.199927 27.6459111,13.199927 L27.7109116,13.199927 C28.2108557,13.199927 28.6030323,12.796967 28.6030323,12.2998905 C28.6030324,11.7993486 29.0024484,11.399854 29.4951531,11.399854 L30.4522743,11.399854 L30.7448301,11.1150769 C31.0843394,10.7845948 31.0209719,10.3265877 30.5819181,10.1128978 L30.3226304,9.98670097 C29.8842057,9.77331723 29.8835766,9.42655123 30.3226304,9.21286132 L30.5819181,9.08666449 C30.8796701,8.94174691 31.4270561,9.05187418 31.74767,9.13746427 L31.74767,9.13746427 C29.354055,6.5500601 26.1162974,4.75498325 22.4719557,4.1897922 L22.4719557,4.1897922 L23.5257222,5.21678951 C24.2305071,5.90367045 24.0320251,6.65048619 23.0799479,6.88245898 L21.4350099,7.28324666 L20.1865042,8.50003612 C19.4817194,9.18691704 18.4903848,9.06670377 17.9747489,8.2291421 L17.3154121,7.15816288 C16.7989905,6.31932509 17.052872,5.20558795 17.8807174,4.66771105 L17.4094436,4.97391227 C18.1837126,4.47084565 19.4969845,4.06343412 20.4690548,4.00674356 C20.3132511,4.0022581 20.1568893,4 20,4 C16.3409492,4 12.9687755,5.22826668 10.2732905,7.29498839 L9.34598541,8.7 C9.34598541,8.7 11.1732265,9.31523437 11.1732265,9.31523437 C11.6403222,9.47250609 12.1428675,9.22457657 12.3008953,8.74570313 L12.6280585,7.75429687 C12.7837571,7.28248174 13.2647344,7.07917156 13.7009406,7.29947834 L14.8796059,7.89476545 C15.7601466,8.33948421 16.7269068,9.46648951 17.0331889,10.3946197 L17.0830463,10.5457031 C17.2387449,11.0175183 16.9561285,11.4 16.4656183,11.4 L13.8009733,11.4 L12.0189781,13.2 L12.0189781,15.015919 C12.0189781,15.5041835 11.7405414,15.61875 11.3957227,15.2704473 L10.236983,14.1 L9.25216787,14.5973827 C8.8118975,14.8197421 8.45498784,15.3994783 8.45498784,15.9 C8.45498784,16.3970563 8.80456327,17.0118645 9.2107158,17.2580182 L12.9099757,19.5 L13.8947908,19.0026173 C14.3350612,18.7802579 15.0162561,18.8183745 15.4320035,19.0983398 L19.7477607,22.0045816 C21.3842844,23.1066207 21.4906005,25.0341584 19.9878775,26.3076091 L16.4715636,29.2874348 C16.0984226,29.6036452 15.5824366,30.1960211 15.3130082,30.6200946 L13.8009729,33 C13.3088887,33 12.995925,32.6093202 13.1006804,32.1331581 L14.3096882,26.6376532 C14.520817,25.6779738 13.9707442,24.5357431 13.0976108,24.0947654 L12.7223406,23.9052346 C11.8417999,23.4605158 11.4800454,22.3887558 11.9199672,21.5000227 L12.9099757,19.5 L8.41107755,17.9852154 C7.94324417,17.8276953 7.31902279,17.3906968 7.00711679,16.996875 L4.98917024,14.4489557 Z"></path>
						</svg>
						Moment<br>Timezone
					</a>
				</div>
				<div class="nav-pages">
						<a href="" class="active">首页</a>
						<a href="index.html">文档</a>
						<a href="index3.html">指南</a>
					<a href="javascript:window.open('https://cloud.tencent.com/act/cps/redirect?redirect=1052&cps_key=ba37a4035bf8632f048bcc83cce9f035&from=console');" target="_blank" rel="nofollow">云服务器</a>
				</div>
			</div>
		</nav>

		



<header class="hero hero-moment">
	<div class="centered">
		<div class="hero-circle">
			<div class="hero-face">
				<div id="hour" class="hero-hour"></div>
				<div id="minute" class="hero-minute"></div>
				<div id="second" class="hero-second"></div>
			</div>
		</div>
		<div class="hero-title">
			<h1>Moment.js <span>2.24.0</span></h1>
			<h2>JavaScript 日期处理类库</h2>
		</div>
	</div>
</header>


<div class="builds">
	<div class="builds-download">
		<h3>下载</h3>
		<a class="builds-button builds-button-source" href="javascript:window.open('http://cdn.staticfile.org/moment.js/2.24.0/moment.js');" target="_blank">
			moment.js
		</a>
		<a class="builds-button builds-button-gzipped" href="javascript:window.open('http://cdn.staticfile.org/moment.js/2.24.0/moment.min.js');" target="_blank">
			moment.min.js
			<span class="filesize">16.7k</span>
		</a>
		<a class="builds-button builds-button-source" href="javascript:window.open('http://cdn.staticfile.org/moment.js/2.24.0/moment-with-locales.js');" target="_blank">
			moment-多语言支持.js
		</a>
		<a class="builds-button builds-button-gzipped" href="javascript:window.open('http://cdn.staticfile.org/moment.js/2.24.0/moment-with-locales.min.js');" target="_blank">
			moment-多语言支持.min.js
			<span class="filesize">67.8k</span>
		</a>
	</div>
	<div class="builds-packages">
		<h3>安装</h3>
		<pre><code>npm install moment --save   <span class="comment"># npm</span>
yarn add moment             <span class="comment"># Yarn</span>
Install-Package Moment.js   <span class="comment"># NuGet</span>
spm install moment --save   <span class="comment"># spm</span>
meteor add momentjs:moment  <span class="comment"># meteor</span>
bower install moment --save <span class="comment"># bower (废弃)</span>
</code></pre>
	</div>
</div>

<div class="page-moment-index">

<h3>日期格式化</h3>
<pre><code class="language-js">moment().format('MMMM Do YYYY, h:mm:ss a');
moment().format('dddd');
moment().format(&quot;MMM Do YY&quot;);
moment().format('YYYY [escaped] YYYY');
moment().format();
</code></pre>
<h3>相对时间</h3>
<pre><code class="language-js">moment(&quot;20111031&quot;, &quot;YYYYMMDD&quot;).fromNow();
moment(&quot;20120620&quot;, &quot;YYYYMMDD&quot;).fromNow();
moment().startOf('day').fromNow();
moment().endOf('day').fromNow();
moment().startOf('hour').fromNow();
</code></pre>
<h3>日历时间</h3>
<pre><code class="language-js">moment().subtract(10, 'days').calendar();
moment().subtract(6, 'days').calendar();
moment().subtract(3, 'days').calendar();
moment().subtract(1, 'days').calendar();
moment().calendar();
moment().add(1, 'days').calendar();
moment().add(3, 'days').calendar();
moment().add(10, 'days').calendar();
</code></pre>
<h3>多语言支持</h3>
<pre><code class="language-js">moment.locale();
moment().format('LT');
moment().format('LTS');
moment().format('L');
moment().format('l');
moment().format('LL');
moment().format('ll');
moment().format('LLL');
moment().format('lll');
moment().format('LLLL');
moment().format('llll');
</code></pre>

<div class="locales">
		<div class="button active" data-locale="zh-cn">
			汉语 (简体)
		</div>
		<div class="button " data-locale="zh-hk">
			汉语 (香港繁体)
		</div>
		<div class="button " data-locale="zh-tw">
			汉语 (台湾繁体)
		</div>
		<div class="button " data-locale="bo">
			藏语
		</div>
		<div class="button " data-locale="ug-cn">
			维吾尔语 (中国)
		</div>
		<div class="button " data-locale="en">
			英语 (美国)
		</div>
		<div class="button " data-locale="en-gb">
			英语 (英国)
		</div>
		<div class="button " data-locale="en-au">
			英语 (澳大利亚)
		</div>
		<div class="button " data-locale="en-ca">
			英语 (加拿大)
		</div>
		<div class="button " data-locale="en-ie">
			英语 (爱尔兰)
		</div>
		<div class="button " data-locale="en-il">
			英语 (以色列)
		</div>
		<div class="button " data-locale="en-nz">
			英语 (新西兰)
		</div>
		<div class="button " data-locale="en-SG">
			英语 (新加坡)
		</div>
		<div class="button " data-locale="ja">
			日语
		</div>
		<div class="button " data-locale="ko">
			韩语
		</div>
		<div class="button " data-locale="th">
			泰语
		</div>
		<div class="button " data-locale="af">
			南非语
		</div>
		<div class="button " data-locale="sq">
			阿尔巴尼亚语
		</div>
		<div class="button " data-locale="ar">
			阿拉伯语
		</div>
		<div class="button " data-locale="ar-dz">
			阿拉伯语 (阿尔及利亚)
		</div>
		<div class="button " data-locale="ar-kw">
			阿拉伯语 (科威特)
		</div>
		<div class="button " data-locale="ar-ly">
			阿拉伯语 (利比亚)
		</div>
		<div class="button " data-locale="ar-ma">
			阿拉伯语 (摩洛哥)
		</div>
		<div class="button " data-locale="ar-sa">
			阿拉伯语 (沙特)
		</div>
		<div class="button " data-locale="ar-tn">
			阿拉伯语 (突尼斯)
		</div>
		<div class="button " data-locale="hy-am">
			亚美尼亚语
		</div>
		<div class="button " data-locale="az">
			阿塞拜疆语
		</div>
		<div class="button " data-locale="bm">
			班巴拉语
		</div>
		<div class="button " data-locale="eu">
			巴斯克语
		</div>
		<div class="button " data-locale="be">
			白俄罗斯语
		</div>
		<div class="button " data-locale="bn">
			孟加拉语
		</div>
		<div class="button " data-locale="bs">
			波斯尼亚语
		</div>
		<div class="button " data-locale="br">
			布列塔尼语
		</div>
		<div class="button " data-locale="bg">
			保加利亚语
		</div>
		<div class="button " data-locale="my">
			缅甸语
		</div>
		<div class="button " data-locale="km">
			柬埔寨语
		</div>
		<div class="button " data-locale="ca">
			加泰罗尼亚语
		</div>
		<div class="button " data-locale="tzm">
			塔马塞特语
		</div>
		<div class="button " data-locale="tzm-latn">
			塔马塞特语 (拉丁)
		</div>
		<div class="button " data-locale="cv">
			楚瓦什语
		</div>
		<div class="button " data-locale="hr">
			克罗地亚语
		</div>
		<div class="button " data-locale="cs">
			捷克语
		</div>
		<div class="button " data-locale="da">
			丹麦语
		</div>
		<div class="button " data-locale="nl">
			荷兰语
		</div>
		<div class="button " data-locale="nl-be">
			荷兰语 (比利时)
		</div>
		<div class="button " data-locale="eo">
			世界语
		</div>
		<div class="button " data-locale="et">
			爱沙尼亚语
		</div>
		<div class="button " data-locale="fo">
			法罗群
		</div>
		<div class="button " data-locale="fi">
			芬兰语
		</div>
		<div class="button " data-locale="fr">
			法语
		</div>
		<div class="button " data-locale="fr-ca">
			法语 (加拿大)
		</div>
		<div class="button " data-locale="fr-ch">
			法语 (瑞士)
		</div>
		<div class="button " data-locale="fy">
			弗里斯兰语
		</div>
		<div class="button " data-locale="gl">
			加利西亚语
		</div>
		<div class="button " data-locale="ka">
			格鲁吉亚语
		</div>
		<div class="button " data-locale="de">
			德语
		</div>
		<div class="button " data-locale="de-at">
			德语 (奥地利)
		</div>
		<div class="button " data-locale="de-ch">
			德语 (瑞士)
		</div>
		<div class="button " data-locale="el">
			希腊语
		</div>
		<div class="button " data-locale="gu">
			古吉拉特语
		</div>
		<div class="button " data-locale="he">
			希伯来语
		</div>
		<div class="button " data-locale="hi">
			印地语
		</div>
		<div class="button " data-locale="hu">
			匈牙利语
		</div>
		<div class="button " data-locale="is">
			冰岛语
		</div>
		<div class="button " data-locale="id">
			印尼语
		</div>
		<div class="button " data-locale="ga">
			爱尔兰盖尔语
		</div>
		<div class="button " data-locale="it">
			意大利语
		</div>
		<div class="button " data-locale="it-ch">
			意大利语 (瑞士)
		</div>
		<div class="button " data-locale="jv">
			爪哇语
		</div>
		<div class="button " data-locale="kn">
			坎纳达语
		</div>
		<div class="button " data-locale="kk">
			哈萨克语
		</div>
		<div class="button " data-locale="tlh">
			克林贡语
		</div>
		<div class="button " data-locale="gom-latn">
			贡根语 (拉丁)
		</div>
		<div class="button " data-locale="ku">
			库尔德语
		</div>
		<div class="button " data-locale="ky">
			吉尔吉斯坦语
		</div>
		<div class="button " data-locale="lo">
			老挝语
		</div>
		<div class="button " data-locale="lv">
			拉脱维亚语
		</div>
		<div class="button " data-locale="lt">
			立陶宛语
		</div>
		<div class="button " data-locale="lb">
			卢森堡语
		</div>
		<div class="button " data-locale="mk">
			马其顿语
		</div>
		<div class="button " data-locale="ms-my">
			马来语 (马来西亚)
		</div>
		<div class="button " data-locale="ms">
			马来语
		</div>
		<div class="button " data-locale="ml">
			马拉雅拉姆语
		</div>
		<div class="button " data-locale="dv">
			马尔代夫语
		</div>
		<div class="button " data-locale="mt">
			马耳他语 (马耳他)
		</div>
		<div class="button " data-locale="mi">
			毛利语
		</div>
		<div class="button " data-locale="mr">
			马拉地语
		</div>
		<div class="button " data-locale="mn">
			蒙古语
		</div>
		<div class="button " data-locale="me">
			黑山语
		</div>
		<div class="button " data-locale="ne">
			尼泊尔语
		</div>
		<div class="button " data-locale="se">
			北萨米语
		</div>
		<div class="button " data-locale="nb">
			挪威语
		</div>
		<div class="button " data-locale="nn">
			新挪威语
		</div>
		<div class="button " data-locale="fa">
			波斯语
		</div>
		<div class="button " data-locale="pl">
			波兰语
		</div>
		<div class="button " data-locale="pt">
			葡萄牙语
		</div>
		<div class="button " data-locale="pt-br">
			葡萄牙语 (巴西)
		</div>
		<div class="button " data-locale="x-pseudo">
			伪语
		</div>
		<div class="button " data-locale="pa-in">
			旁遮普语 (印度)
		</div>
		<div class="button " data-locale="ro">
			罗马尼亚语
		</div>
		<div class="button " data-locale="ru">
			俄语
		</div>
		<div class="button " data-locale="gd">
			苏格兰盖立语
		</div>
		<div class="button " data-locale="sr">
			塞尔维亚语
		</div>
		<div class="button " data-locale="sr-cyrl">
			塞尔维亚语 (西里尔)
		</div>
		<div class="button " data-locale="sd">
			信德语
		</div>
		<div class="button " data-locale="si">
			僧伽罗语
		</div>
		<div class="button " data-locale="sk">
			斯洛伐克语
		</div>
		<div class="button " data-locale="sl">
			斯洛维尼亚语
		</div>
		<div class="button " data-locale="es">
			西班牙语
		</div>
		<div class="button " data-locale="es-do">
			西班牙语 (多米尼加共和国)
		</div>
		<div class="button " data-locale="es-us">
			西班牙语 (美国)
		</div>
		<div class="button " data-locale="sw">
			斯瓦希里语
		</div>
		<div class="button " data-locale="sv">
			瑞典语
		</div>
		<div class="button " data-locale="tl-ph">
			他加禄语 (菲律宾)
		</div>
		<div class="button " data-locale="tg">
			塔吉克语
		</div>
		<div class="button " data-locale="tzl">
			塔罗萨语
		</div>
		<div class="button " data-locale="ta">
			泰米尔语
		</div>
		<div class="button " data-locale="te">
			泰卢固语
		</div>
		<div class="button " data-locale="tet">
			帝力德顿语 (东帝汶)
		</div>
		<div class="button " data-locale="tr">
			土耳其语
		</div>
		<div class="button " data-locale="uk">
			乌克兰语
		</div>
		<div class="button " data-locale="ur">
			乌尔都语
		</div>
		<div class="button " data-locale="uz">
			乌兹别克语
		</div>
		<div class="button " data-locale="uz-latn">
			乌兹别克语 (拉丁)
		</div>
		<div class="button " data-locale="vi">
			越南语
		</div>
		<div class="button " data-locale="cy">
			威尔士语
		</div>
		<div class="button " data-locale="yo">
			尼日利亚约鲁巴语
		</div>
		<div class="button " data-locale="ss">
			西斯瓦提语
		</div>
</div>

</div>



		<footer>
			<p>
				<a href="" style="color: inherit;">Moment.js中文网</a>，本站由
				<a href="javascript:window.open('http://nodejs.cn/');" target="_blank" style="color: inherit;">Node.js中文网</a> 提供技术支持
			</p>
		</footer>

		<script src="static/js/jquery.min.js"></script>
		<script src="static/js/moment-with-locales.min.js"></script>
		<script src="static/js/moment-timezone-with-data.min.js"></script>
		<script src="static/js/global.js"></script>
			<script src="static/js/core-home.js"></script>

		<script src="static/js/highlight.min.js"></script>
		<script src="static/js/javascript.min.js"></script>
		<script>hljs.initHighlightingOnLoad();</script>
		<script>var _hmt = _hmt || []; (function () { var hm = document.createElement("script"); hm.src = "//hm.baidu.com/hm.js?7a7f78c805fbacc7e075d34f153031aa"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })();</script>
	</body>
</html>
